Merge "Default $wgActorTableSchemaMigrationStage to READ_NEW"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 9 Apr 2019 20:26:30 +0000 (20:26 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 9 Apr 2019 20:26:30 +0000 (20:26 +0000)
1  2 
RELEASE-NOTES-1.33
tests/phpunit/MediaWikiTestCase.php

diff --combined RELEASE-NOTES-1.33
@@@ -57,6 -57,10 +57,10 @@@ For notes on 1.32.x and older releases
    argon2 to be used, by default, it will automatically choose the best available
    algorithm depending on which version of PHP you have available. To use this,
    you can set `$wgPasswordDefault = 'argon2';`.
+ * $wgActorTableSchemaMigrationStage now defaults to reading the new schema.
+   update.php will back-populate the new database fields due to the changed
+   setting, which may take some time on large wikis. You can avoid downtime by
+   following a process like that described in T188327.
  
  ==== Removed configuration ====
  * $wgTagStatisticsNewTable (T199334) — This temporary setting, added in
@@@ -436,8 -440,6 +440,8 @@@ because of Phabricator reports
    insertions into links tables.
  * Category::newFromID( $id )->getID() will now return $id without any
    validation, to avoid a mostly unnecessary DB query.
 +* On Special:Version, the name for an extension can no longer be arbitrary
 +  html when no link is specified.
  
  == Compatibility ==
  MediaWiki 1.33 requires PHP 7.0.13 or later. Although HHVM 3.18.5 or later is
@@@ -401,8 -401,7 +401,8 @@@ abstract class MediaWikiTestCase extend
                        self::$useTemporaryTables = !$this->getCliArg( 'use-normal-tables' );
                        self::$reuseDB = $this->getCliArg( 'reuse-db' );
  
 -                      $this->db = wfGetDB( DB_MASTER );
 +                      $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
 +                      $this->db = $lb->getConnection( DB_MASTER );
  
                        $this->checkDbIsSupported();
  
                        JobQueueGroup::singleton()->get( $type )->delete();
                }
  
 +              // T219673: close any connections from code that failed to call reuseConnection()
 +              // or is still holding onto a DBConnRef instance (e.g. in a singleton).
 +              MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->closeAll();
                CloneDatabase::changePrefix( self::$oldTablePrefix );
  
                self::$oldTablePrefix = false;
         * @note this method only works when first called. Subsequent calls have no effect,
         * even if using different parameters.
         *
 -       * @param Database $db The database connection
 +       * @param IMaintainableDatabase $db The database connection
         * @param string $prefix The prefix to use for the new table set (aka schema).
         *
         * @throws MWException If the database table prefix is already $prefix
         */
 -      public static function setupTestDB( Database $db, $prefix ) {
 +      public static function setupTestDB( IMaintainableDatabase $db, $prefix ) {
                if ( self::$dbSetup ) {
                        return;
                }
  
                if ( $tablesToRestore ) {
                        $this->recloneMockTables( $db, $tablesToRestore );
 +
 +                      // Reset the restored tables, mainly for the side effect of
 +                      // re-calling $this->addCoreDBData() if necessary.
 +                      $this->resetDB( $db, $tablesToRestore );
                }
        }
  
  
                if ( $oldOverrides['alter'] || $oldOverrides['create'] || $oldOverrides['drop'] ) {
                        $this->undoSchemaOverrides( $db, $oldOverrides );
 +                      unset( $db->_schemaOverrides );
                }
  
                // Determine new overrides.
                        if ( array_intersect( $tablesUsed, $userTables ) ) {
                                $tablesUsed = array_unique( array_merge( $tablesUsed, $userTables ) );
                                TestUserRegistry::clear();
+                               // Reset $wgUser, which is probably 127.0.0.1, as its loaded data is probably not valid
+                               // @todo Should we start setting $wgUser to something nondeterministic
+                               //  to encourage tests to be updated to not depend on it?
+                               global $wgUser;
+                               $wgUser->clearInstanceCache( $wgUser->mFrom );
                        }
                        if ( array_intersect( $tablesUsed, $pageTables ) ) {
                                $tablesUsed = array_unique( array_merge( $tablesUsed, $pageTables ) );